package com.cmc.cloud.cmclink.doc.vo.sovo.requirementsvo;

import com.cmc.cloud.cmclink.doc.util.so.CompareUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * 订舱附加要求 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 *
 * @author codegen
 */
@Data
public class RequirementsBaseVO {

    @Schema(description = "外键", example = "13351")
    private Long referenceId;

    @Schema(description = "业务类型 so、 si", example = "1")
    @Length(max = 10, message = "{requirements.referencetype.length}")
    private String referenceType;

    @Schema(description = "备注字段类型", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{requirements.requiretypecode.notblank}")
    @Length(max = 30, message = "{requirements.requiretypecode.length}")
    private String requireTypeCode;

    @Schema(description = "备注字段类型", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "{requirements.requirecode.notblank}")
    @Length(max = 50, message = "{requirements.requirecode.length}")
    private String requireCode;

    @Schema(description = "备注字段内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
    @NotBlank(message = "{requirements.requireremark.notblank}")
    @Length(max = 200, message = "{requirements.requireremark.length}")
    private String requireRemark;

    public static CompareUtils<RequirementsBaseVO> getMultiFieldComparator() {
        return new CompareUtils<RequirementsBaseVO>().comparingField(RequirementsBaseVO::getReferenceType)
                .thenComparing(RequirementsBaseVO::getRequireTypeCode)
                .thenComparing(RequirementsBaseVO::getRequireCode)
                .thenComparing(RequirementsBaseVO::getRequireRemark);
    }

}
